<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>随机生成字符串</title>
</head>
<body>
    
    <script>
        {
            // 随机生成字符串
            var str = 'abcdefghijklmnopqrstuvwxyz9876543210';

            function createStr (str,n) {
                let ary= [];
                for(let i=0;i<n;i++){
                    let num = Math.floor(Math.random()*35+1);
                    ary.push(str[num]);
                }
                let s = ary.join('');
                return s;
            }

            console.log(createStr(str,5));
        }
    </script>

</body>
</html>